Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allows user to specify to use an existing tag for release #2053

Merged
merged 3 commits into from
Mar 22, 2024

Conversation

maastha
Copy link
Collaborator

@maastha maastha commented Mar 20, 2024

Description

Currently in case of any failure during release, we need to manually delete the created tag and re-run release workflow at which point a new tag is created from master. It is possible that other PRs are merged to master during this time which causes below issues:

  • It may require us to re-run QA acceptance tests
  • Changelog might be required to be updated again
  • We may need to request the team to stop new PR merges until release is done

This PR allows us to specify if we want to use an existing tag during TF release so any new PR merges to master wouldn't impact an ongoing release.

Link to any related issue(s):

Type of change:

  • Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
  • New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contribution guidelines
  • I have checked that this change does not generate any credentials and that they are NOT accidentally logged anywhere.
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code
  • If changes include deprecations or removals, I defined an isolated PR with a relevant title as it will be used in the auto-generated changelog.
  • If changes include removal or addition of 3rd party GitHub actions, I updated our internal document. Reach out to the APIx Integration slack channel to get access to the internal document.

Further comments

Testing:

  1. Created a temporary release workflow with use_existing_tag not set (default) -> New tag was created (test run)
  2. Created a temporary release workflow with use_existing_tag=true -> Existing tag was used (test run), see below partial logs:
[action-create-tag] Create tag 'v0.1.0-pre1'.
[action-create-tag] Tag 'v0.1.0-pre1' already exists.
[action-create-tag] Please set 'force_push_tag' to 'true' if you want to overwrite it.
[action-create-tag] Ignoring error since 'tag_exists_error' is set to 'false'.

@@ -28,6 +30,7 @@ jobs:
uses: ./.github/workflows/acceptance-tests.yml
with:
atlas_cloud_env: "qa"
ref: ${{ inputs.use_existing_tag == 'true' && inputs.version_number }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ref: ${{ inputs.use_existing_tag == 'true' && inputs.version_number }}
ref: ${{ inputs.use_existing_tag == 'true' && inputs.version_number || github.ref }}

Copy link
Collaborator

@oarbusi oarbusi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I agree w/ Leo on simplifying the boolean expression

Copy link
Member

@AgustinBettati AgustinBettati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we can also revise this ticket https://jira.mongodb.org/browse/CLOUDP-221414 as I believe it would no longer be relevant.

@@ -10,6 +10,8 @@ on:
required: true
skip_tests:
description: 'Skip QA acceptance tests, define value to `true` to explicitly skip'
use_existing_tag:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a small note in our release documentation on when this scenario could be useful or comes into picture?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

@maastha maastha marked this pull request as ready for review March 21, 2024 13:00
@maastha maastha requested a review from a team as a code owner March 21, 2024 13:00
@@ -15,6 +15,7 @@ We pre-release the provider to make for testing purpose. **A Pre-release is not
- Using our [Release GitHub Action](https://github.com/mongodb/terraform-provider-mongodbatlas/actions/workflows/release.yml) run a new workflow using `master` and the following inputs:
- Version number: vX.Y.Z-pre
- Skip QA acceptance tests: Should be left empty. Only used in case failing tests have been encountered in QA and the team agrees the release can still de done, or successful run of QA acceptance tests has already been done with the most recent changes.
- Using an existing tag: Should be left empty (default `false` creates a new tag from `master`). This should be set to `true` only if you want to re-use an existing tag for the release and the tag name should adhere to our version number format.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add in the comment that this will typically be useful when the release process failed (e.g. because tests failed) and want to try to release again

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's necessary tbh as long as the tag exists for any use-case this can be used anyway

@maastha maastha merged commit 234cb7f into master Mar 22, 2024
65 checks passed
@maastha maastha deleted the update-release-use-existing-tag branch March 22, 2024 09:00
oarbusi added a commit that referenced this pull request Mar 22, 2024
…ted (#2052)

* schedule compatibility matrix first day of month

* WIP: test if status can be retrieved

* test

* test echo job status

* change

* Revert "change"

This reverts commit 4b0e49e.

* Revert "test echo job status"

This reverts commit 4a83862.

* test getting outputs of matrix

* result

* send slack

* checkout step

* fix name

* correct json

* formating

* Revert "formating"

This reverts commit f584822.

* format

* try

* Revert "try"

This reverts commit 7029f54.

* use cat

* Revert "use cat"

This reverts commit 9503cd2.

* remove unnecesary double quote

* try cat

* Revert "try cat"

This reverts commit a2df8ff.

* return json

* unify json

* fix

* enrich message

* TEMP: tag oncall on success

* chore: Updates Atlas Go SDK (#2044)

* build(deps): bump go.mongodb.org/atlas-sdk

* fix tags

* undo changes to admin20231001002

* API breaking change fixes

---------

Co-authored-by: lantoli <[email protected]>

* chore: Follow-up to Atlas SDK upgrade (#2051)

* remove unused NewGroup

* unify List call thanks to new API

* refactor: Uses mocks on admin.APIClient for Project+Teams+ClustersAPIs instead of custom service (#2045)

* refactor: Uses mocks on admin.APIClient instead of custom ClusterService (#2056)

* fix: Fixes `network_container` resource update (#2055)

* failing test

* recreate resource if provider_name changes

* fix update

* allow update in place when provider_name changes

* fix regions error handling

* refactor tests checks

* refactor checks in mig tests as well

* fix change check

* use MONGODB_ATLAS_PROJECT_ID (#2060)

* chore: Removes old service from mockery (#2063)

* feat: Allows user to specify to use an existing tag for release (#2053)

* remove TEMP oncall tag on success

* initialize oncall_tag

* send notification when test suite fails

* revert back testing change

* remove temporary trigger of action

* use oncall tag from secrets

* Revert "use oncall tag from secrets"

This reverts commit 5a7944f.

* use SHA

* new line

* make oncall tag a secret

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: lantoli <[email protected]>
Co-authored-by: Espen Albert <[email protected]>
Co-authored-by: maastha <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants